package com.kefu.chat.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.kefu.basic.model.BasicStatusConfig;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "添加状态")
public class ChatStatusConfigInsertVo extends AbstractInsertVo<BasicStatusConfig> {
    @NotEmpty
    @ApiModelProperty(value = "状态名")
    private String statusName;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "状态图标")
    private String statusIcon;

    @Override
    public BasicStatusConfig convert() {
        BasicStatusConfig info = BeanUtil.toBean(this, BasicStatusConfig.class);
        info.setStatusType(1);
        info.setTenantId(KefuContext.getTid());
        info.setUpdateTime(DateUtil.current());
        info.setUpdateUser(KefuContext.getUid());
        info.setId(IdUtil.simpleUUID());
        return info;
    }
}
